Skip to content

fix(core): keep allure serve alive when historyPath is configured - #861

Open
svasenkov wants to merge 1 commit into
allure-framework:mainfrom
svasenkov:fix/serve-historypath
Open

fix(core): keep allure serve alive when historyPath is configured#861
svasenkov wants to merge 1 commit into
allure-framework:mainfrom
svasenkov:fix/serve-historypath

Conversation

@svasenkov

Copy link
Copy Markdown
Contributor

Summary

  • Fixes allure serve silently exiting after report generation when historyPath is set in allurerc.mjs (Fixes [CLI] allure serve silently exits without starting the server when historyPath is set #827).
  • Root cause: AllureLocalHistory.appendHistory() piped into a FileHandle write stream with autoClose: false and closed the handle before the stream was destroyed. On Node.js 20+ this leaves a pending promise and can terminate the process before serve starts.
  • Finish and destroy the write stream before closing the file handle.

Test plan

  • packages/core history tests, including a standalone Node subprocess reproducing the FileHandle stream lifecycle
  • packages/cli integration test: allure serve allure-results with historyPath prints Allure is running on http://localhost:… and keeps running
  • Manual repro against published allure@3.14.3 flow (history written, process used to exit with code 0 before server URL)

Made with Cursor

AllureLocalHistory.appendHistory left FileHandle write streams ref'd after
pipeline completed. Closing the handle then made Node exit before report.done()
and serve resolved, which matched the silent allure serve exit in allure-framework#827.

Finish and destroy the write stream before closing the file handle, and add
regression coverage for the stream lifecycle and serve integration.

Co-authored-by: Cursor <cursoragent@cursor.com>
d-braun added a commit to d-braun/allure3 that referenced this pull request Sep 8, 2026
Nothing in the suite could reproduce the silent exit that `historyPath`
caused (allure-framework#827, allure-framework#895): Yarn's PnP runtime replaces `fs/promises.open` with a
ZipFS-backed handle whose `close()` doesn't wait for stream references,
which hides the deadlock from every in-process test and from anything
started through `yarn node`.

- add a core test that copies the built packages into a real `node_modules`
  tree and runs the history code in a plain `node` process; without the fix
  it reports "Detected unsettled top-level await" and exits with code 13
- add an end-to-end `allure serve` test with `historyPath` configured,
  adapted from allure-framework#861; it covers the symptom of allure-framework#827 in environments with
  real `node_modules` and stays a smoke test under PnP
- hoist the CLI build in `run.integration.test.ts` to file level, so it
  can't wipe `dist` while another suite drives the built CLI
- create the write stream after the `limit === 0` early returns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CLI] allure serve silently exits without starting the server when historyPath is set

1 participant